﻿using MediatR;
using T.Vehicleservice.Domain.T.Vehicleservice.Model;
using T.Vehicleservice.Read.API.Application.Command.ExpenseCommand;
using T.Vehicleservice.Read.API.Application.Command.MaintenanceRecordCommand;
using T.Vehicleservice.Repository.ImpI;
using T.Vehicleservice.Repository.Interface;

namespace T.Vehicleservice.Read.API.Application.CommandHandlers.ExpenseCommandHandler
{
    public class ExpenseBackfillCommandHandler : IRequestHandler<ExpenseBackfilleCommand, ExpenseRecord>
    {
        IExpenseRecordRepository expenseRecordRepository;

        public ExpenseBackfillCommandHandler(IExpenseRecordRepository expenseRecordRepository)
        {
            this.expenseRecordRepository = expenseRecordRepository;
        }

        public async Task<ExpenseRecord> Handle(ExpenseBackfilleCommand request, CancellationToken cancellationToken)
        {
            return await expenseRecordRepository.GetModelAsync(request.ExpenseId);
        }
    }
}
